<?php

/*
 * 定义一个SOAP客户端
 * non-wsdl方式调用web service
 */

// 创建 SoapClient 对象
 $options = array(
    'location'=> 'http://localhost/soap/server.php', //url
    'uri'=> 'soap/server',
 );
 $wsdl = NULL;
 $client = new SoapClient($wsdl, $options);
 try {
     // 调用函数
     $message = $client->get_message();
     //$addition = $client->add_numbers(1,2);
     $addition = $client->__soapCall("add_numbers",[1,2]);
     var_dump($message, $addition);
 } catch(SoapFault $fault) {
     echo "SOAP Fault: " . $fault->getMessage();
 }
?>